﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace SARD.Aux_Forms
{
    public partial class MTFform : Form
    {
        int sizex, sizey;


        /// <summary>
        /// Initializes the form.
        /// </summary>
        public MTFform()
        {
            InitializeComponent();
        }

        /// <summary>
        /// Corrects the desired size and stores it in a class local variable.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button1_Click(object sender, EventArgs e)
        {
            sizex = 32 * (int)Math.Pow(2, (listBox1.SelectedIndex));
            sizey = sizex;
            this.Close();
        }


        /// <summary>
        /// Returns the x size.
        /// </summary>
        /// <returns></returns>
        public int returnsizex() 
        {
            return sizex;
        }

        /// <summary>
        /// Returns the y size.
        /// </summary>
        /// <returns></returns>
        public int returnsizey()
        {
            return sizey;
        }

        /// <summary>
        /// Cancel the operation
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button2_Click(object sender, EventArgs e)
        {
            sizex = 0;
            sizey = 0;
            this.Close();
        }

        /// <summary>
        /// Instead of a fixed size a variable one is selected. 
        /// It is done by a new form that returns x and y sizes.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button3_Click(object sender, EventArgs e)
        {
            variablesize size = new variablesize();
            size.ShowDialog();

            sizex = size.returnsizex();
            sizey = size.returnsizey();
            this.Close();

        }
    }
}
